const fs = require('fs');
const xml2js = require('xml2js');

const xmlBuilder = new xml2js.Builder();

var readStream = fs.createReadStream('city.json');

var data = '';

readStream.on('data', rs => {
    data += rs;
})

readStream.on('end', () => {
    var obj = JSON.parse(data);
    var strXml = xmlBuilder.buildObject(obj);
    var writeStream = fs.createWriteStream('city_.xml');
    writeStream.write(strXml);
    writeStream.close();
})